package com.space.school.service.impl;

import com.space.school.dao.RegisterDao;
import com.space.school.dao.impl.RegisterDaoImpl;
import com.space.school.service.UserInsertService;

public class UserInsertServiceImpl implements UserInsertService {
    private RegisterDao registerDao=new RegisterDaoImpl();

    @Override
    public int register(String username, String password) {
        //        密码判断
        String regex="^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])[?=.*[a-zA-Z0-9]{6}$]";
        if(!password.matches(regex)){
//            返回为2的情况是密码不满足条件
            return 2;
        }
        return registerDao.register(username, password);
    }
}
